var orderModel=require('../models/order');
var adressModel=require('../models/adress');
var orderQueren={
    orderQueren:(req,res,next)=>{
        adressModel.find({user_id:req.session.loginUser._id}).sort({sort:1}).then(doc=>{
            orderModel.findOne({ user_id: req.session.loginUser._id }).sort({ number: -1 }).then(doc2 => {
                console.log(doc2)
                res.render('orderQueren', { adress:doc,order:doc2,loginUser: req.session.loginUser });
            })
        })
    },
}
module.exports = orderQueren